styleproperty: Add flags
authorBenjamin Otte <otte@redhat.com>
Tue, 31 May 2011 10:20:47 +0000 (12:20 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 2 Jun 2011 00:03:52 +0000 (02:03 +0200)
This allows to set a bunch of specific features, like inheritance in
here, without having to molest the psec.

gtk/gtkstyleproperties.c
gtk/gtkstyleproperty.c
gtk/gtkstylepropertyprivate.h

index dfe79154277c2db8e2d7f8ddbe18f241e294ff05..4f9a4bb112d15b187b07a5ba0f1a1d6946d16d40 100644 (file)
@@ -312,6 +312,7 @@ gtk_style_properties_register_property (GtkStylePropertyParser  parse_func,
   g_return_if_fail (G_IS_PARAM_SPEC (pspec));
 
   _gtk_style_property_register (pspec,
+                                0,
                                 parse_func,
                                 NULL,
                                 NULL,
index a6bf2345633ce3f6884477781a5175d74908d2fa..0a3a2e120d60188a2cbd5d890234021228b10d9c 100644 (file)
@@ -1946,7 +1946,8 @@ _gtk_style_property_is_inherit (const GtkStyleProperty *property)
 {
   g_return_val_if_fail (property != NULL, FALSE);
 
-  return gtk_style_param_get_inherit (property->pspec);
+  return property->flags & GTK_STYLE_PROPERTY_INHERIT ||
+    gtk_style_param_get_inherit (property->pspec);
 }
 
 gboolean
@@ -2017,6 +2018,7 @@ gtk_style_property_init (void)
                               G_TYPE_STRV, 0);
   gtk_style_param_set_inherit (pspec, TRUE);
   _gtk_style_property_register           (pspec,
+                                          0,
                                           NULL,
                                           NULL,
                                           NULL,
@@ -2057,6 +2059,7 @@ gtk_style_property_init (void)
                               PANGO_TYPE_FONT_DESCRIPTION, 0);
   gtk_style_param_set_inherit (pspec, TRUE);
   _gtk_style_property_register           (pspec,
+                                          0,
                                           NULL,
                                           unpack_font_description,
                                           pack_font_description,
@@ -2095,6 +2098,7 @@ gtk_style_property_init (void)
                                                               "Margin",
                                                               "Margin",
                                                               GTK_TYPE_BORDER, 0),
+                                          0,
                                           NULL,
                                           unpack_margin,
                                           pack_margin,
@@ -2125,6 +2129,7 @@ gtk_style_property_init (void)
                                                               "Padding",
                                                               "Padding",
                                                               GTK_TYPE_BORDER, 0),
+                                          0,
                                           NULL,
                                           unpack_padding,
                                           pack_padding,
@@ -2155,6 +2160,7 @@ gtk_style_property_init (void)
                                                               "Border width",
                                                               "Border width, in pixels",
                                                               GTK_TYPE_BORDER, 0),
+                                          0,
                                           NULL,
                                           unpack_border_width,
                                           pack_border_width,
@@ -2166,6 +2172,7 @@ gtk_style_property_init (void)
                                                               "Border top left radius",
                                                               "Border radius of top left corner, in pixels",
                                                               GTK_TYPE_CSS_BORDER_CORNER_RADIUS, 0),
+                                          0,
                                           NULL,
                                           NULL,
                                           NULL,
@@ -2176,6 +2183,7 @@ gtk_style_property_init (void)
                                                               "Border top right radius",
                                                               "Border radius of top right corner, in pixels",
                                                               GTK_TYPE_CSS_BORDER_CORNER_RADIUS, 0),
+                                          0,
                                           NULL,
                                           NULL,
                                           NULL,
@@ -2186,6 +2194,7 @@ gtk_style_property_init (void)
                                                               "Border bottom right radius",
                                                               "Border radius of bottom right corner, in pixels",
                                                               GTK_TYPE_CSS_BORDER_CORNER_RADIUS, 0),
+                                          0,
                                           NULL,
                                           NULL,
                                           NULL,
@@ -2196,6 +2205,7 @@ gtk_style_property_init (void)
                                                               "Border bottom left radius",
                                                               "Border radius of bottom left corner, in pixels",
                                                               GTK_TYPE_CSS_BORDER_CORNER_RADIUS, 0),
+                                          0,
                                           NULL,
                                           NULL,
                                           NULL,
@@ -2206,6 +2216,7 @@ gtk_style_property_init (void)
                                                             "Border radius",
                                                             "Border radius, in pixels",
                                                             0, G_MAXINT, 0, 0),
+                                          0,
                                           NULL,
                                           unpack_border_radius,
                                           pack_border_radius,
@@ -2250,6 +2261,7 @@ gtk_style_property_init (void)
                                                               "Key bindings",
                                                               "Key bindings",
                                                               G_TYPE_PTR_ARRAY, 0),
+                                          0,
                                           NULL,
                                           NULL,
                                           NULL,
@@ -2268,6 +2280,7 @@ _gtk_style_property_lookup (const char *name)
 
 void
 _gtk_style_property_register (GParamSpec               *pspec,
+                              GtkStylePropertyFlags     flags,
                               GtkStylePropertyParser    property_parse_func,
                               GtkStyleUnpackFunc        unpack_func,
                               GtkStylePackFunc          pack_func,
@@ -2291,6 +2304,7 @@ _gtk_style_property_register (GParamSpec               *pspec,
     }
 
   node = g_slice_new0 (GtkStyleProperty);
+  node->flags = flags;
   node->pspec = pspec;
   node->property_parse_func = property_parse_func;
   node->pack_func = pack_func;
index 7ee23f80f0ca46e02080e350e53f99a56f385c41..dab6f07af0dbf56d88329bcd0ebfa09c6190d7c4 100644 (file)
@@ -25,6 +25,9 @@
 G_BEGIN_DECLS
 
 typedef struct _GtkStyleProperty GtkStyleProperty;
+typedef enum {
+  GTK_STYLE_PROPERTY_INHERIT = (1 << 0)
+} GtkStylePropertyFlags;
 
 typedef GParameter *     (* GtkStyleUnpackFunc)            (const GValue           *value,
                                                             guint                  *n_params);
@@ -43,6 +46,8 @@ typedef void             (* GtkStyleDefaultValueFunc)      (GtkStyleProperties
 struct _GtkStyleProperty
 {
   GParamSpec               *pspec;
+  GtkStylePropertyFlags     flags;
+
   GtkStylePropertyParser    property_parse_func;
   GtkStyleUnpackFunc        unpack_func;
   GtkStylePackFunc          pack_func;
@@ -54,6 +59,7 @@ struct _GtkStyleProperty
 const GtkStyleProperty * _gtk_style_property_lookup        (const char             *name);
 
 void                     _gtk_style_property_register      (GParamSpec             *pspec,
+                                                            GtkStylePropertyFlags   flags,
                                                             GtkStylePropertyParser  property_parse_func,
                                                             GtkStyleUnpackFunc      unpack_func,
                                                             GtkStylePackFunc        pack_func,